<!DOCTYPE html>
<html lang="en">
<head>
    <style>
        body {
            margin-top: 20px;
            margin: 0 auto;
        }

        .carousel-inner .item img {
            width: 100%;
            height: 300px;
        }
    </style>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="js/parm.js"></script>
    <script>
        $(document).ready(function () {
            $(".megamenu").megamenu();
            $.ajax({
                url: "type/findAll.do",
                type: "POST",
                data: {},
                dataType: "json",
                cache: false,
                success: function (data) {
                    $("#typeOfBook").append("<li class=\"active grid\"><a href=\"index.html\" id=\"indexType\">主页</a></li>");
                    for (var i = 0; i < data.length; i++) {
                        var dataVar = "<li><a class=\"color7\" onclick=\"clickType(this," + data[i].id + ")\" href=\"javascript:void(0);\">" + data[i].name + "</a></li>";
                        $("#typeOfBook").append(dataVar);
                    }
                }
            });
        });

        var uid = null;
        /*获得session中的对象*/
        $.ajax({
            url: "user/getUser.do",
            type: "POST",
            data: {},
            dataType: "json",
            cache: false,
            success: function (data) {
                if (data != null && (uid = data.id) != null) {
                    dataStr = "          <li>欢迎你,"+data.username+"</li>\n" +
                        "                |\n" +
                        "                <li><a href=\"logout.html\">注销</a></li>\n" +
                        "                |\n" +
                        "                <li><a href=\"checkout.html\">书架</a></li>\n" +
                        "                |\n" +
                        "                <li><a href=\"checkbag.html\">书包</a></li>\n" +
                        "                |\n" +
                        "                <li><a href=\"uploadBook.html\">闲书上传</a></li>\n" +
                        "                |\n" +
                        "                <li class=\"active\"><a href=\"record.html\">订单记录</a></li>";
                    $("#title_user").append(dataStr);
                } else {
                    dataStr = "<li><a href=\"login.html\">登录</a></li>\n" +
                        "                |\n" +
                        "      <li><a href=\"register.html\">注册</a></li>";
                    $("#title_user").append(dataStr);
                }
            }
        });
    </script>
    <!--点击事件函数-->
    <script type="text/javascript">
        function clickType(data, id) {
            $.cookie("typeName", data.text);
            $.cookie("typeId", id);
            window.location = "showBook.html";
        }
    </script>
</head>
<body>
<div class="header-top">
    <div class="wrap">
        <div class="header-top-left">
            <div class="box">
            </div>
            <div class="clear"></div>
        </div>
        <div class="cssmenu">

            <ul id="title_user">
                <!--存放用户功能栏-->

            </ul>
        </div>
        <div class="clear"></div>
    </div>
</div>
<div class="header-bottom">
    <div class="wrap">
        <div class="header-bottom-left">
            <!--logo图标-->
            <div class="logo">
                <a href="index.html"><img src="images/logo.png" alt=""/></a>
            </div>
            <div class="menu">
                <ul class="megamenu skyblue" id="typeOfBook">


                </ul>
            </div>
        </div>
        <div class="header-bottom-right">

            <div class="tag-list">
                <div class="search">
                    <input type="text" id="SerachText" name="s" class="textbox" value="Search"
                           onfocus="this.value = '';"
                           onblur="if (this.value == '') {this.value = 'Search';}">
                    <input type="submit" value="Subscribe" onclick="searceMH($('#SerachText').val())" id="submit"
                           name="submit">

                    <div id="response"></div>
                </div>
            </div>
        </div>
        <div class="clear"></div>
    </div>
    <script type="text/javascript">
        function searceMH(data) {
            // alert(data);
            /*将模糊查找的内容通过cookie传到模糊查找页面*/
            $.cookie("search", data);
            window.location = "fuzzySearch.html";
        }
    </script>
</div>
</body>
</html>